import { defineStore } from 'pinia'
import { i18n } from '@/languages/index'

export const useLocaleStore = defineStore('locale', {
  state: () => {
    return {
      locale: localStorage.getItem('language') || 'en'
    }
  },
  actions: {
    setLocaleAction(locale) {
      this.locale = locale
      localStorage.setItem('language', locale)
      i18n.global.locale.value = locale
    }
  },
  getters: {}
})
